﻿using System;
using System.Collections.Generic;
using System.Data;
using Smatime.Web.DAO.SmatimeDatasetTableAdapters;
using Smatime.Web.Models;

namespace Smatime.Web.DAO
{
    public class StaffTimeEditRepository :
        BaseRepository<StaffTimeEdit, SmatimeDataset.StaffTimeEditDataTable, StaffTimeEditTableAdapter>
    {
        /// <summary>
        ///     get data by id and date forgot
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public StaffTimeEdit GetListById(long id, DateTime stampdate)
        {
            using (var adapter = new StaffTimeEditTableAdapter())
            {
                var list = new List<StaffTimeEdit>();
                using (var table = adapter.GetDataBy(id, stampdate))
                {
                    var row = table.Rows[0];
                    return (StaffTimeEdit) (new StaffTimeEdit().FromDataRow(row));
                }
            }
        }
    }
}